<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>登录</title>
	<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/logon.css" />
</head>

<body style="background: #76A5DB;overflow:hidden">
<form class="form-inline" name="myForm" action="http://172.16.202.224:8080/core/user/login/" method="post">
	<div class="logon" id="logon">
		<div class="longo_ion"></div>
		<div class="form_input">
			<div class="form-group">
				<label class="col-sm-4 control-label">用户名：</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" placeholder="请输入名字" name="username">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-4 control-label">密码：</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" placeholder="请输入名字" name="password">
				</div>
			</div>
			<button type="button" class="btn btn-primary" onclick="uploadInfo">登录</button>
		</div>
	</div>
</form>
<script src="/static/js/jquery-3.1.1.min.js"></script>
<script>
	function uploadInfo(){
		$.ajax({
    		url: '172.16.200.252:8080/core/user/login/',
    		type: 'post',
    		dataType: 'json',
    		data: {},
    		success: function(response){
						if(response.success==1){
							location.href='/';
							return
						}
						else{
							alert(response.error_msg);
							return
						}
			},
    		error: function(XMLHttpRequest, textStatus, errorThrown){
				switch (XMLHttpRequest.status) {
                    case(500):
                        alert('服务器系统内部错误');
                        break;
                    case(403):
                        alert("无权限执行此操作");
                        break;
                    case(408):
                        alert("请求超时");
                        break;
                    default:
                        alert(XMLHttpRequest.responseText);
                }
    		}
	 	});
	}
</script>
</body>
</html>